package org.scalpel.HHObjects;

import java.util.ArrayList;

import org.scalpel.common.HHObject;
import org.scalpel.common.KeyPoint;

import android.util.Log;

/**
 * 
 * @author Jerome Monceaux
 *
 * Basic test class to check input output connection using different parameters type.
 */
public class Test extends HHObject {
	
	public Test(String fName) {
		super(fName);
	}
	
	public void logAnInt( int v){					Log.i("TestProcess", "int value : " + Integer.toString(v));	}
	public void logADouble( double v){		Log.i("TestProcess", "double value : " + Double.toString(v));	}
	public void logAFloat( float v){			Log.i("TestProcess", "float value : " + Float.toString(v));	}
	public void logABoolean( boolean v){	Log.i("TestProcess", "boolean value : " + Boolean.toString(v));	}
	public void logAString( String v){		Log.i("TestProcess", "String value : " + v);	}
	public void logALong( long v){				Log.i("TestProcess", "long value : " + Long.toString(v));	}
	public void logAShort( short v){			Log.i("TestProcess", "short value : " + Short.toString(v));	}
	public void logAChar( char v){				Log.i("TestProcess", "char value : " + Character.toString(v));	}
	public void logAByte( byte v){				Log.i("TestProcess", "byte value : " + Byte.toString(v));	}
	public void logAVoid( ){							Log.i("TestProcess", "void");}
	public void logAFloatArray( ArrayList<Float> v){Log.i("TestProcess", "ArrayList<Float> " + v.toString());	}
	public void logAKeyPoint( KeyPoint v){Log.i("TestProcess", "KeyPoint : " + v.toString());	}
	public void log2ParameterDoubleString( double d, String s){Log.i("TestProcess", "2param  double : " + Double.toString(d) + " String : " + s);	}
	
	public void sendAnInt( ){			send("sendAnInt", 1);}
	public void sendADouble( ){		send("sendADouble", 1.);}
	public void sendAFloat( ){		send("sendAFloat", 1.f);}
	public void sendABoolean( ){	send("sendABoolean", true);}
	public void sendAString( ){		send("sendAString", "hello");}
	public void sendALong( ){			Long l=(long)1.; send("sendALong", l);}
	public void sendAShort( ){		short i=1; send("sendAShort", i);}
	public void sendAChar( ){			send("sendAChar", 'a');}
	public void sendAByte( ){			byte b=1; send("sendAByte", b);}
	public void sendAVoid( ){			send("sendAVoid", null);}
	public void sendAFloatArray(){
		ArrayList<Float> f= new ArrayList<Float>();
		f.add(1.2f);
		f.add(2.4f);
		send("sendAFloatArray", f);
	}
	public void sendAKeyPoint(){  
		KeyPoint k = new KeyPoint(1.1, 2.2, 0., 0.);
		send("sendAKeyPoint", k);
	}
	public void send2ParameterDoubleString(){ 
		setChanged();
		notifyObservers(new Object[]{"send2ParameterDoubleString", new Object[]{1.2, "hello"}});
	}

	
	private void send(String outputName, Object op){
		setChanged();
		if( op != null)
			notifyObservers(new Object[]{outputName, new Object[]{op}});
		else
			notifyObservers(new Object[]{outputName, null});
	}

	@Override
	public void finish() {
		// TODO Auto-generated method stub
		
	}

}
